/*
 * SolicitarAperturaTopico.java
 *
 * Created on Oct 27, 2008, 4:56:30 PM
 */
 
package wasolicitudesfiec.AperturaTopico;

import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.rave.web.ui.component.Button;
import com.sun.rave.web.ui.component.TextArea;
import com.sun.rave.web.ui.component.Upload;
import javax.faces.FacesException;
import javax.faces.application.FacesMessage;
import wasolicitudesfiec.Menu;
import wasolicitudesfiec.general.MensajeException;
import web.util.Constantes;
import wasolicitudesfiec.logicacontrol.SolicitarAperturaTopico.CTRL_SolicitarAperturaTopico;
import web.util.validadores.ValidadorFileUpload;

public class SolicitarAperturaTopico extends AbstractPageBean {
    private CTRL_SolicitarAperturaTopico cTRL_SolicitarApertura;
    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">

    /**
     * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
     * This method is automatically generated, so any user-specified code inserted
     * here is subject to being replaced.</p>
     */
    private void _init() throws Exception {
    }
    private TextArea txtaTema = new TextArea();

    public TextArea getTxtaTema() {
        return txtaTema;
    }

    public void setTxtaTema(TextArea ta) {
        this.txtaTema = ta;
    }
    private Upload fuArchivo = new Upload();

    public Upload getFuArchivo() {
        return fuArchivo;
    }

    public void setFuArchivo(Upload u) {
        this.fuArchivo = u;
    }
    private TextArea txtaObservaciones = new TextArea();

    public TextArea getTxtaObservaciones() {
        return txtaObservaciones;
    }

    public void setTxtaObservaciones(TextArea ta) {
        this.txtaObservaciones = ta;
    }
    private Button btnEnviar = new Button();

    public Button getBtnEnviar() {
        return btnEnviar;
    }

    public void setBtnEnviar(Button b) {
        this.btnEnviar = b;
    }

    // </editor-fold>
 private ValidadorFileUpload validadorFileUpload = new ValidadorFileUpload();

    /**
     * <p>Construct a new Page bean instance.</p>
     */
    public SolicitarAperturaTopico() {
         cTRL_SolicitarApertura = new CTRL_SolicitarAperturaTopico(this, this.getFacesContext());
    }

    
    @Override
    public void init() {
       
        super.init();
        // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            _init();
        } catch (Exception e) {
            log("SolicitarAperturaTopico Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
        }
        
        // </editor-fold>
      this.getMenu().setTitulo(Constantes.Modelo.modelo_SolicitarAperturaTopico);
    }

    /**
     * <p>Callback method that is called after the component tree has been
     * restored, but before any event processing takes place.  This method
     * will <strong>only</strong> be called on a postback request that
     * is processing a form submit.  Customize this method to allocate
     * resources that will be required in your event handlers.</p>
     */
    @Override
    public void preprocess() {
    }

    /**
     * <p>Callback method that is called just before rendering takes place.
     * This method will <strong>only</strong> be called for the page that
     * will actually be rendered (and not, for example, on a page that
     * handled a postback and then navigated to a different page).  Customize
     * this method to allocate resources that will be required for rendering
     * this page.</p>
     */
    @Override
    public void prerender() {
    }

    /**
     * <p>Callback method that is called after rendering is completed for
     * this request, if <code>init()</code> was called (regardless of whether
     * or not this was the page that was actually rendered).  Customize this
     * method to release resources acquired in the <code>init()</code>,
     * <code>preprocess()</code>, or <code>prerender()</code> methods (or
     * acquired during execution of an event handler).</p>
     */
    @Override
    public void destroy() {
    }

    
  public Menu getMenu() {
        return (Menu) getBean("SolicitudesFIEC$Menu");
    }

    public String btnEnviar_action() {
      FacesMessage message;
        try {
            this.cTRL_SolicitarApertura.guardarActividadSolicitarAperturaTopico();
            cTRL_SolicitarApertura.addCookieMensaje("Su solicitud ha sido enviada exitosamente.",null);
            return "mensaje";
        } catch (MensajeException ex) {
            message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ex.getMessage(), ex.getMessage());
            getFacesContext().addMessage(null, message);
            return null;
        }
    }

    /**
     * @return the validadorFileUpload
     */
    public ValidadorFileUpload getValidadorFileUpload() {
        return validadorFileUpload;
    }

    /**
     * @param validadorFileUpload the validadorFileUpload to set
     */
    public void setValidadorFileUpload(ValidadorFileUpload validadorFileUpload) {
        this.validadorFileUpload = validadorFileUpload;
    }

    
}

